<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<body tabindex=1>
<input type="button">
<script>
var test = async_test('Do not cause an assertion failure in Document::setFocusedElement.');
window.onload = function() {
    var input = document.querySelector('input');
    input.onfocus = function() { test.done(); };
    test.step(function() {
        document.body.addEventListener('focusout', function() {
            input.type = 'text'
        });
        document.body.focus();
        input.focus();
    });
};
</script>
</body>
